Companion

object Companion

Properties

Link copied to clipboard

Calculates the obsolete U.S. IRS double-category average cost figures (LT/ST shares held before each sale). The IRS withdrew the method in 2011. Off by default since MD2027. When off, the work is skipped and the three totSaleSharesAvailable fields are 0.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun deriveTxnDateRangesForTaxDates(book: AccountBook, accounts: Set<Account>, taxDateRange: DateRange, onlyCostImpactingTxns: Boolean = true, txns: TxnSet? = null): Map<Account, DateRange>

Derive, per account, the transaction date range covering every txn whose tax date falls within taxDateRange. Use it to widen a calculation's universe so that tax date selection can see txns dated outside the requested range. Scans all of the relevant txns, so call it once, early, and only when needed.

Link copied to clipboard
fun getInvalidLotMatchSellTxns(sec: Account, txns: TxnSet? = null, failFast: Boolean = false, debug: Boolean = false): List<SplitTxn>?

Validates the integrity of cost-basis lot matching for a lot-controlled Security Account. Checks performed:

Link copied to clipboard

Determine whether the specified txn type is one that actually impacts cost basis calculations i.e. typically these do: BUY, BUY_XFER, COVER, DIVIDEND_REINVEST, SELL, SELL_XFER, SHORT, MISCINC, MISCEXP these don't: BANK, DIVIDEND, DIVIDENDXFR

Link copied to clipboard

Validates the integrity of cost-basis lot matching for a lot-controlled Security Account. Refer: getInvalidLotMatchSellTxns for details of validation checks performed. >> if getUnmatchedSaleLots returns null or empty, then cost basis will be valid. >> passes failFast parameter true. I.e. validation check stop on first error detected.